package org.wu.framework.authorization.platform.infrastructure.converter;

import org.wu.framework.authorization.platform.infrastructure.entity.SysDictionaryDO;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.SysDictionary;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyInfrastructureConverter
 **/

public class SysDictionaryConverter {


    /**
     * describe 实体对象 转换成领域对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionary toDictionary(SysDictionaryDO sysDictionaryDO) {
        if (null != sysDictionaryDO) {
            SysDictionary sysDictionary = new SysDictionary();
            sysDictionary.setCode(sysDictionaryDO.getCode());
            sysDictionary.setCreateTime(sysDictionaryDO.getCreateTime());
            sysDictionary.setDescription(sysDictionaryDO.getDescription());
            sysDictionary.setId(sysDictionaryDO.getId());
            sysDictionary.setName(sysDictionaryDO.getName());
            sysDictionary.setType(sysDictionaryDO.getType());
            sysDictionary.setUpdateTime(sysDictionaryDO.getUpdateTime());
            return sysDictionary;
        }
        return null;
    }

    /**
     * describe 领域对象 转换成实体对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryDO fromDictionary(SysDictionary sysDictionary) {
        if (null != sysDictionary) {
            SysDictionaryDO sysDictionaryDO = new SysDictionaryDO();
            sysDictionaryDO.setCode(sysDictionary.getCode());
            sysDictionaryDO.setCreateTime(sysDictionary.getCreateTime());
            sysDictionaryDO.setDescription(sysDictionary.getDescription());
            sysDictionaryDO.setId(sysDictionary.getId());
            sysDictionaryDO.setName(sysDictionary.getName());
            sysDictionaryDO.setType(sysDictionary.getType());
            sysDictionaryDO.setUpdateTime(sysDictionary.getUpdateTime());
            return sysDictionaryDO;
        }
        return null;
    }

}